<template>
  <div>
    <h1 style="font-size: 28px">站点详情</h1>
    <div>
      <a-form :label-col="{ span: 4 }" :wrapper-col="{ span: 14 }">
        <a-form-item label="站点ID">
          <a-input :value="id" disabled/>
        </a-form-item>
        <a-form-item label="地址">
          <a-input :value="address" disabled/>
        </a-form-item>
        <a-form-item label="经度">
          <a-input :value="geo_lng" disabled/>
        </a-form-item>
        <a-form-item label="纬度">
          <a-input :value="geo_lat" disabled/>
        </a-form-item>
        <a-form-item label="创建人">
          <a-input :value="creator_name" disabled/>
        </a-form-item>
        <a-form-item label="更新人">
          <a-input :value="updater_name" disabled/>
        </a-form-item>
        <a-form-item label="创建时间">
          <a-input :value="create_time" disabled/>
        </a-form-item>
        <a-form-item label="更新时间">
          <a-input :value="update_time" disabled/>
        </a-form-item>
        <a-form-item label="描述">
          <a-textarea :value="intro" disabled/>
        </a-form-item>
        <a-form-item :wrapper-col="{ span: 14, offset: 4 }">
          <a-button style="width: 140px;" @click="onBack">返回</a-button>
        </a-form-item>
      </a-form>
    </div>
  </div>
</template>

<script lang="ts">
import {defineComponent, reactive, toRefs} from "vue";

export default defineComponent({
  name: 'SiteDetail',
  props: {
    item: {
      type: Object,
      default: null,
    },
    viewType: {
      type: String,
      default: null,
    }
  },
  setup(props, {emit}) {

    const data = reactive({
      id: props.item.id,
      geo_lng: props.item.geo_lng,
      geo_lat: props.item.geo_lat,
      address: props.item.address,
      intro: props.item.intro,
      creator_name: props.item.creator_name,
      updater_name: props.item.updater_name,
      create_time: props.item.create_time,
      update_time: props.item.update_time,
    });

    const onBack = () => {
      emit("my-emit", 'Cancel');
    }

    return {
      ...toRefs(data),
      onBack
    };
  }
});

</script>

<style scoped>

</style>
